$(function () {
    let id=localStorage.getItem("companyid");
    findById(id);
})
function findById(id) {
    let data=myAjax("/company/findById",{id:id},"post");
    setData(data.companyModel);
}
function setData(data) {
    $("#showlogo").attr("src", data.logo);
    $("#email").val(data.email);
    $("#hotline").val(data.hotline);
    $("#address").val(data.address);
    $("#phone").val(data.phone);
    $("#tel").val(data.tel);
    $("#landline").val(data.landline);
}

function companyimguapdate() {
    let formData=new FormData();// let data=new FormData()传文件
    formData.append("file",$("#logo")[0].files[0]);
    let da=myAjaxTwo("/upLoad",formData,"post");

    if (da!=null){
        companyuapdate(da);
    }


    function companyuapdate(img) {
        let data={
            logo:img,
            email:$("#email").val(),
            hotline:$("#hotline").val(),
            address:$("#address").val(),
            phone:$("#phone").val(),
            tel:$("#tel").val(),
            landline:$("#landline").val()
        }
        let da=myAjax("/company/update",data,"post")
        if (da.result==1){
            alert("修改成功");
            $('#reght').load('../back/company/companyfandAll.html')
        }else {
            alert("修改失败");
        }
    }
}